import Vue from 'vue'
import Router from 'vue-router'
import Index from '../view/index'
import SettleAccounts from '../view/settleAccounts'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      component: () => import('../view/login')
    },
    {
      path: '/personalCenter',
      name: 'personalCenter',
      meta: {
        title: '个人中心'
      },
      component: () => import('../view/personalCenter'),
      redirect: '/personalCenter/myOrder',
      children: [
        {
          path: '/personalCenter/myOrder',
          name: 'myOrder',
          icon: 'el-icon-s-order',
          meta: {
            title: '我的订单'
          },
          component: () => import('../view/personalCenter/myOrder/')
        },
        {
          path: '/personalCenter/specialTicketApply',
          name: 'specialTicketApply',
          icon: 'el-icon-s-ticket',
          meta: {
            title: '专票申请'
          },
          component: () => import('../view/personalCenter/specialTicketApply/')
        },
        {
          path: '/personalCenter/basicInfo',
          name: 'basicInfo',
          icon: 'el-icon-s-marketing',
          meta: {
            title: '基础信息'
          },
          component: () => import('../view/personalCenter/basicInfo/')
        },
        {
          path: '/personalCenter/goodsReceivingInfo',
          name: 'goodsReceivingInfo',
          icon: 'el-icon-s-claim',
          meta: {
            title: '收货信息'
          },
          component: () => import('../view/personalCenter/goodsReceivingInfo/')
        },
        {
          path: '/personalCenter/personalInfo',
          name: 'myOrder',
          icon: 'el-icon-s-custom',
          meta: {
            title: '人员信息'
          },
          component: () => import('../view/personalCenter/personalInfo/')
        }
      ]
    },
    {
      path: '/index',
      name: 'index',
      component: Index,
      meta: {
        isBack: false,
        keepAlive: true//组件需要被缓存
      }
    },
    {
      path: '/settleAccounts',
      name: 'settleAccounts',
      component: SettleAccounts,
    },
  ]
})
